/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package assignment_cp3120.ucm;

import assignment_cp3120.dataObjects.DepartureLocation;
import assignment_cp3120.manager.editairport.EditAirportModel;
import assignment_cp3120.manager.editairport.EditAirportView;

/**
 * PRECONDITION: view has been shown
 *
 * 1. User fills in form
 * 2. System gets the airport to edit
 * 3. System edits the selected airport with the given info.
 *
 * POSTCONDITION: airport has been changed
 * @author Administrator
 */
public class UCEditAirports implements UseCaseController{
    private EditAirportView view;
    private EditAirportModel model;

    public UCEditAirports() {
        this(new EditAirportView(), new EditAirportModel());
    }
    public UCEditAirports(EditAirportView view, EditAirportModel model) {
        this.view = view;
        this.model = model;
    }
    
    public void run() {
        //* 2. System gets the airport to edit
        DepartureLocation testAirport = view.getEditAirport();
        //* 3. System edits the selected airport with the given info.
        model.editAirport(testAirport, view.getId(), view.getAirportName(), view.getAirportTax());

        view.clearView();
    }
}
